package com.gupao.pattern.singleton.regiter;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 注册式map
 */
public class RegiterMap {


    private RegiterMap (){}

    private static Map<String , Object>  regiter = new ConcurrentHashMap<String, Object>();

    public static RegiterMap getInstatce(String name){

        if ( name == null ) {

            name = RegiterMap.class.getName();
        }

        if (regiter.get(name) == null){
            regiter.put(name,new RegiterMap());
        }

        return (RegiterMap)regiter.get(name);


    }
}
